#include<stdio.h>

int main() {
    char a[50][50], b[50][50];
    int m, n, count = 0;

    scanf("%d %d", &n, &m);
    getchar();//读取'\n'
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%c", &a[i][j]);
        }
        getchar();//读取'\n'
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'f' || a[i][j] == 'a' || a[i][j] == 'c' || a[i][j] == 'e')
                b[i][j] = a[i][j];
            else
                b[i][j] = '\0';
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (b[i][j] + b[i + 1][j] + b[i + 1][j + 1] + b[i][j + 1] == 'f' + 'a' + 'c' + 'e')//比较ASCII
                count++;
        }
    }
    printf("%d", count);

    return 0;
}

/*给你n∗m的二维网格，求2∗2的方格的个数，方框里面的字符可以构成'face'*/